package model;
/**
 *
 * @author Gruppe 5
 */
public class Salgslinje

{
    private int id;
    private int antal;
    private Vare saelgVare;
    
    public Salgslinje(int antal, Vare saelgVare)
    {
        this.antal = antal;
        this.saelgVare = saelgVare;
    }

    public int getId()
    {
        return id;
    }

        public void setId(int id)
    {
        this.id = id;
    }
    
    
    public int getAntal()
    {
        return antal;
    }


    
    public String getVareType()
    {
        return saelgVare.getType();
    }

    public double getPris()
    {
        return saelgVare.getPris();
    }

    public String getRabat()
    {
        return saelgVare.getFastRabat() + " %";
    }

    public double beregnPris()
    {
        double Pris = saelgVare.getPris();
        double rabat = saelgVare.getFastRabat();
        rabat = ( Pris / 100 ) * rabat;
        Pris = Pris - rabat;
        double totalPris = 0;
        totalPris = (totalPris + Pris) * getAntal();
        return totalPris;
    }
   
    public String getBeskrivelse()
    {
        return "\nVare: " + getVareType() + ". Antal: " + getAntal() +
                ". Pris pr styk: " + getPris() + " kr." + " Pris i alt: " +
                beregnPris();
    }
}
